<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>beyondml.pt.utils package &mdash; BeyondML  documentation</title>
      <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
      <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
        <script src="_static/jquery.js"></script>
        <script src="_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script>
        <script src="_static/doctools.js"></script>
        <script src="_static/sphinx_highlight.js"></script>
    <script src="_static/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="beyondml.tflow package" href="beyondml.tflow.html" />
    <link rel="prev" title="beyondml.pt.layers package" href="beyondml.pt.layers.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >

          
          
          <a href="index.html" class="icon icon-home">
            BeyondML
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <p class="caption" role="heading"><span class="caption-text">Documentation:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="modules.html">beyondml</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="beyondml.html">beyondml package</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="beyondml.html#subpackages">Subpackages</a><ul class="current">
<li class="toctree-l4 current"><a class="reference internal" href="beyondml.pt.html">beyondml.pt package</a></li>
<li class="toctree-l4"><a class="reference internal" href="beyondml.tflow.html">beyondml.tflow package</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="beyondml.html#module-beyondml">Module contents</a></li>
</ul>
</li>
</ul>
</li>
</ul>

        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">BeyondML</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="modules.html">beyondml</a></li>
          <li class="breadcrumb-item"><a href="beyondml.html">beyondml package</a></li>
          <li class="breadcrumb-item"><a href="beyondml.pt.html">beyondml.pt package</a></li>
      <li class="breadcrumb-item active">beyondml.pt.utils package</li>
      <li class="wy-breadcrumbs-aside">
            <a href="_sources/beyondml.pt.utils.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="beyondml-pt-utils-package">
<h1>beyondml.pt.utils package<a class="headerlink" href="#beyondml-pt-utils-package" title="Permalink to this heading"></a></h1>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this heading"></a></h2>
</section>
<section id="module-beyondml.pt.utils.utils">
<span id="beyondml-pt-utils-utils-module"></span><h2>beyondml.pt.utils.utils module<a class="headerlink" href="#module-beyondml.pt.utils.utils" title="Permalink to this heading"></a></h2>
<dl class="py function">
<dt class="sig sig-object py" id="beyondml.pt.utils.utils.prune_model">
<span class="sig-prename descclassname"><span class="pre">beyondml.pt.utils.utils.</span></span><span class="sig-name descname"><span class="pre">prune_model</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">model</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">percentile</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/beyondml/pt/utils/utils.html#prune_model"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#beyondml.pt.utils.utils.prune_model" title="Permalink to this definition"></a></dt>
<dd><p>Prune a compatible model</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>model</strong> (<em>PyTorch model</em>) – A model that has been developed to have a <cite>.layers</cite> property containing layers to be pruned</p></li>
<li><p><strong>percentile</strong> (<em>int</em>) – An integer between 0 and 99 which corresponds to how much to prune the model</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p><strong>pruned_model</strong> – The pruned model</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>PyTorch model</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<ul class="simple">
<li><p>The model input <strong>must</strong> have a <cite>.layers</cite> property to be able to function. Only layers within the
<cite>.layers</cite> property which are recognized as prunable are pruned, via their own <cite>.prune()</cite> method</p></li>
<li><p>Also acts on the model in place, but returns the model for ease of use</p></li>
</ul>
</dd></dl>

</section>
<section id="module-beyondml.pt.utils">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-beyondml.pt.utils" title="Permalink to this heading"></a></h2>
<p>Some additional utilities for building MANN models in PyTorch.</p>
</section>
</section>


           </div>
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="beyondml.pt.layers.html" class="btn btn-neutral float-left" title="beyondml.pt.layers package" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="beyondml.tflow.html" class="btn btn-neutral float-right" title="beyondml.tflow package" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2023, BeyondML Labs.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>